package com.hr.剑指offer.work1;

import java.util.Arrays;

/**
 * @author 周恒哲
 * @date 2020/06/17
 **/
public class 面试题45_把数组排成最小的数 {
    public static String minNumber(int[] nums) {
        String[] strs=new String[nums.length];
        for (int i = 0; i < nums.length; i++) {
            strs[i]= String.valueOf(nums[i]);
        }
        Arrays.sort(strs,(x,y)->(x+y).compareTo(y+x));
        StringBuffer sb=new StringBuffer();
        for (String s:strs){
            sb.append(s);
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        面试题45_把数组排成最小的数.minNumber(new int[]{

        });
    }
}
